package com.example.onlineeducation.data.model

import android.os.Parcelable
import androidx.recyclerview.widget.DiffUtil
import kotlinx.android.parcel.Parcelize

@Parcelize
data class ExamRecordListDataModel(
    var examLogId: String?,//考试记录的id
    var examId: String?,//考试的id
    var examName: String,
    var examImage: String?,
    var totalScore: String,//总成绩
    var examTime: String,//考试日期（哪天参加考试的）
    var score: String,//实际成绩
    var isPass: String,//是否通过 0-未通过  1-已通过
    var totalTime: Int?,//考试总时长(分钟)
    var endTime: String?,//考试最晚结束时间
    ) : Parcelable {
    companion object {
        val diffCallback = object : DiffUtil.ItemCallback<ExamRecordListDataModel>() {
            override fun areItemsTheSame(
                oldItem: ExamRecordListDataModel,
                newItem: ExamRecordListDataModel
            ): Boolean {
                return oldItem.examLogId == newItem.examLogId
            }

            override fun areContentsTheSame(
                oldItem: ExamRecordListDataModel,
                newItem: ExamRecordListDataModel
            ): Boolean {
                return oldItem.examLogId == newItem.examLogId
                        && oldItem.examId == newItem.examId
                        && oldItem.examName == newItem.examName
                        && oldItem.examImage == newItem.examImage
                        && oldItem.totalScore == newItem.totalScore
                        && oldItem.examTime == newItem.examTime
                        && oldItem.score == newItem.score
                        && oldItem.isPass == newItem.isPass
                        && oldItem.totalTime == newItem.totalTime
                        && oldItem.endTime == newItem.endTime
            }
        }
    }
}